import { IPSControlAction } from '../ipscontrol-action';
import { PSMDAjaxControlImpl } from '../psmdajax-control-impl';
import { IPSChart } from './ipschart';
import { IPSChartAngleAxis } from './ipschart-angle-axis';
import { IPSChartCoordinateSystem } from './ipschart-coordinate-system';
import { IPSChartDataSet } from './ipschart-data-set';
import { IPSChartDataSetGroup } from './ipschart-data-set-group';
import { IPSChartGrid } from './ipschart-grid';
import { IPSChartParallel } from './ipschart-parallel';
import { IPSChartParallelAxis } from './ipschart-parallel-axis';
import { IPSChartPolar } from './ipschart-polar';
import { IPSChartRadar } from './ipschart-radar';
import { IPSChartRadiusAxis } from './ipschart-radius-axis';
import { IPSChartSingle } from './ipschart-single';
import { IPSChartSingleAxis } from './ipschart-single-axis';
import { IPSChartXAxis } from './ipschart-xaxis';
import { IPSChartYAxis } from './ipschart-yaxis';
import { IPSLanguageRes } from '../../res/ipslanguage-res';

export class PSChartImpl extends PSMDAjaxControlImpl implements IPSChart {
  get coordinateSystem(): 'XY' | 'POLAR' | 'RADAR' | 'PARALLEL' | 'SINGLE' | 'CALENDAR' | 'MAP' | 'NONE' {
    return this.M.coordinateSystem;
  }

  get emptyText(): string {
    return this.M.emptyText;
  }

  protected emptytextpslanguageres: IPSLanguageRes | null = null;

  getEmptyTextPSLanguageRes(): IPSLanguageRes | null {
    if (this.emptytextpslanguageres != null) return this.emptytextpslanguageres;
    const value = this.M.getEmptyTextPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.emptytextpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getEmptyTextPSLanguageRes') as IPSLanguageRes;
    return this.emptytextpslanguageres;
  }

  get emptyTextPSLanguageRes(): IPSLanguageRes | null {
    return this.getEmptyTextPSLanguageRes();
  }

  getEmptyTextPSLanguageResMust(): IPSLanguageRes {
    const value = this.getEmptyTextPSLanguageRes();
    if (value == null) {
      throw new Error('未指定无值内容语言资源');
    }
    return value;
  }

  protected getpscontrolaction: IPSControlAction | null = null;

  getGetPSControlAction(): IPSControlAction | null {
    if (this.getpscontrolaction != null) return this.getpscontrolaction;
    const value = this.M.getGetPSControlAction;
    if (value == null) {
      return null;
    }
    this.getpscontrolaction = this.getPSControlHandlerMust().findPSControlHandlerAction(value);
    return this.getpscontrolaction;
  }

  get getPSControlAction(): IPSControlAction | null {
    return this.getGetPSControlAction();
  }

  getGetPSControlActionMust(): IPSControlAction {
    const value = this.getGetPSControlAction();
    if (value == null) {
      throw new Error('未指定获取数据行为');
    }
    return value;
  }

  protected pschartangleaxises: IPSChartAngleAxis[] | null = null;

  getPSChartAngleAxises(): IPSChartAngleAxis[] | null {
    if (this.pschartangleaxises == null) {
      this.pschartangleaxises = this.fillChildListModel(this.M.getPSChartAngleAxises, 'control.chart.IPSChartAngleAxis') as IPSChartAngleAxis[];
    }
    return this.pschartangleaxises;
  }

  get psChartAngleAxises(): IPSChartAngleAxis[] | null {
    return this.getPSChartAngleAxises();
  }

  findPSChartAngleAxis(objKey: any): IPSChartAngleAxis | null {
    return this.getPSModel5('control.chart.IPSChartAngleAxis', this.getPSChartAngleAxises(), objKey) as IPSChartAngleAxis;
  }

  protected pschartcoordinatesystems: IPSChartCoordinateSystem[] | null = null;

  getPSChartCoordinateSystems(): IPSChartCoordinateSystem[] | null {
    if (this.pschartcoordinatesystems == null) {
      this.pschartcoordinatesystems = this.fillChildListModel(this.M.getPSChartCoordinateSystems, 'control.chart.IPSChartCoordinateSystem') as IPSChartCoordinateSystem[];
    }
    return this.pschartcoordinatesystems;
  }

  get psChartCoordinateSystems(): IPSChartCoordinateSystem[] | null {
    return this.getPSChartCoordinateSystems();
  }

  findPSChartCoordinateSystem(objKey: any): IPSChartCoordinateSystem | null {
    return this.getPSModel5('control.chart.IPSChartCoordinateSystem', this.getPSChartCoordinateSystems(), objKey) as IPSChartCoordinateSystem;
  }

  protected pschartdatasetgroups: IPSChartDataSetGroup[] | null = null;

  getPSChartDataSetGroups(): IPSChartDataSetGroup[] | null {
    if (this.pschartdatasetgroups == null) {
      this.pschartdatasetgroups = this.fillChildListModel(this.M.getPSChartDataSetGroups, 'control.chart.IPSChartDataSetGroup') as IPSChartDataSetGroup[];
    }
    return this.pschartdatasetgroups;
  }

  get psChartDataSetGroups(): IPSChartDataSetGroup[] | null {
    return this.getPSChartDataSetGroups();
  }

  findPSChartDataSetGroup(objKey: any): IPSChartDataSetGroup | null {
    return this.getPSModel5('control.chart.IPSChartDataSetGroup', this.getPSChartDataSetGroups(), objKey) as IPSChartDataSetGroup;
  }

  protected pschartdatasets: IPSChartDataSet[] | null = null;

  getPSChartDataSets(): IPSChartDataSet[] | null {
    if (this.pschartdatasets == null) {
      this.pschartdatasets = this.fillChildListModel(this.M.getPSChartDataSets, 'control.chart.IPSChartDataSet') as IPSChartDataSet[];
    }
    return this.pschartdatasets;
  }

  get psChartDataSets(): IPSChartDataSet[] | null {
    return this.getPSChartDataSets();
  }

  findPSChartDataSet(objKey: any): IPSChartDataSet | null {
    return this.getPSModel5('control.chart.IPSChartDataSet', this.getPSChartDataSets(), objKey) as IPSChartDataSet;
  }

  protected pschartgrids: IPSChartGrid[] | null = null;

  getPSChartGrids(): IPSChartGrid[] | null {
    if (this.pschartgrids == null) {
      this.pschartgrids = this.fillChildListModel(this.M.getPSChartGrids, 'control.chart.IPSChartGrid') as IPSChartGrid[];
    }
    return this.pschartgrids;
  }

  get psChartGrids(): IPSChartGrid[] | null {
    return this.getPSChartGrids();
  }

  findPSChartGrid(objKey: any): IPSChartGrid | null {
    return this.getPSModel5('control.chart.IPSChartGrid', this.getPSChartGrids(), objKey) as IPSChartGrid;
  }

  protected pschartparallelaxises: IPSChartParallelAxis[] | null = null;

  getPSChartParallelAxises(): IPSChartParallelAxis[] | null {
    if (this.pschartparallelaxises == null) {
      this.pschartparallelaxises = this.fillChildListModel(this.M.getPSChartParallelAxises, 'control.chart.IPSChartParallelAxis') as IPSChartParallelAxis[];
    }
    return this.pschartparallelaxises;
  }

  get psChartParallelAxises(): IPSChartParallelAxis[] | null {
    return this.getPSChartParallelAxises();
  }

  findPSChartParallelAxis(objKey: any): IPSChartParallelAxis | null {
    return this.getPSModel5('control.chart.IPSChartParallelAxis', this.getPSChartParallelAxises(), objKey) as IPSChartParallelAxis;
  }

  protected pschartparallels: IPSChartParallel[] | null = null;

  getPSChartParallels(): IPSChartParallel[] | null {
    if (this.pschartparallels == null) {
      this.pschartparallels = this.fillChildListModel(this.M.getPSChartParallels, 'control.chart.IPSChartParallel') as IPSChartParallel[];
    }
    return this.pschartparallels;
  }

  get psChartParallels(): IPSChartParallel[] | null {
    return this.getPSChartParallels();
  }

  findPSChartParallel(objKey: any): IPSChartParallel | null {
    return this.getPSModel5('control.chart.IPSChartParallel', this.getPSChartParallels(), objKey) as IPSChartParallel;
  }

  protected pschartpolars: IPSChartPolar[] | null = null;

  getPSChartPolars(): IPSChartPolar[] | null {
    if (this.pschartpolars == null) {
      this.pschartpolars = this.fillChildListModel(this.M.getPSChartPolars, 'control.chart.IPSChartPolar') as IPSChartPolar[];
    }
    return this.pschartpolars;
  }

  get psChartPolars(): IPSChartPolar[] | null {
    return this.getPSChartPolars();
  }

  findPSChartPolar(objKey: any): IPSChartPolar | null {
    return this.getPSModel5('control.chart.IPSChartPolar', this.getPSChartPolars(), objKey) as IPSChartPolar;
  }

  protected pschartradars: IPSChartRadar[] | null = null;

  getPSChartRadars(): IPSChartRadar[] | null {
    if (this.pschartradars == null) {
      this.pschartradars = this.fillChildListModel(this.M.getPSChartRadars, 'control.chart.IPSChartRadar') as IPSChartRadar[];
    }
    return this.pschartradars;
  }

  get psChartRadars(): IPSChartRadar[] | null {
    return this.getPSChartRadars();
  }

  findPSChartRadar(objKey: any): IPSChartRadar | null {
    return this.getPSModel5('control.chart.IPSChartRadar', this.getPSChartRadars(), objKey) as IPSChartRadar;
  }

  protected pschartradiusaxises: IPSChartRadiusAxis[] | null = null;

  getPSChartRadiusAxises(): IPSChartRadiusAxis[] | null {
    if (this.pschartradiusaxises == null) {
      this.pschartradiusaxises = this.fillChildListModel(this.M.getPSChartRadiusAxises, 'control.chart.IPSChartRadiusAxis') as IPSChartRadiusAxis[];
    }
    return this.pschartradiusaxises;
  }

  get psChartRadiusAxises(): IPSChartRadiusAxis[] | null {
    return this.getPSChartRadiusAxises();
  }

  findPSChartRadiusAxis(objKey: any): IPSChartRadiusAxis | null {
    return this.getPSModel5('control.chart.IPSChartRadiusAxis', this.getPSChartRadiusAxises(), objKey) as IPSChartRadiusAxis;
  }

  protected pschartsingleaxises: IPSChartSingleAxis[] | null = null;

  getPSChartSingleAxises(): IPSChartSingleAxis[] | null {
    if (this.pschartsingleaxises == null) {
      this.pschartsingleaxises = this.fillChildListModel(this.M.getPSChartSingleAxises, 'control.chart.IPSChartSingleAxis') as IPSChartSingleAxis[];
    }
    return this.pschartsingleaxises;
  }

  get psChartSingleAxises(): IPSChartSingleAxis[] | null {
    return this.getPSChartSingleAxises();
  }

  findPSChartSingleAxis(objKey: any): IPSChartSingleAxis | null {
    return this.getPSModel5('control.chart.IPSChartSingleAxis', this.getPSChartSingleAxises(), objKey) as IPSChartSingleAxis;
  }

  protected pschartsingles: IPSChartSingle[] | null = null;

  getPSChartSingles(): IPSChartSingle[] | null {
    if (this.pschartsingles == null) {
      this.pschartsingles = this.fillChildListModel(this.M.getPSChartSingles, 'control.chart.IPSChartSingle') as IPSChartSingle[];
    }
    return this.pschartsingles;
  }

  get psChartSingles(): IPSChartSingle[] | null {
    return this.getPSChartSingles();
  }

  findPSChartSingle(objKey: any): IPSChartSingle | null {
    return this.getPSModel5('control.chart.IPSChartSingle', this.getPSChartSingles(), objKey) as IPSChartSingle;
  }

  protected pschartxaxises: IPSChartXAxis[] | null = null;

  getPSChartXAxises(): IPSChartXAxis[] | null {
    if (this.pschartxaxises == null) {
      this.pschartxaxises = this.fillChildListModel(this.M.getPSChartXAxises, 'control.chart.IPSChartXAxis') as IPSChartXAxis[];
    }
    return this.pschartxaxises;
  }

  get psChartXAxises(): IPSChartXAxis[] | null {
    return this.getPSChartXAxises();
  }

  findPSChartXAxis(objKey: any): IPSChartXAxis | null {
    return this.getPSModel5('control.chart.IPSChartXAxis', this.getPSChartXAxises(), objKey) as IPSChartXAxis;
  }

  protected pschartyaxises: IPSChartYAxis[] | null = null;

  getPSChartYAxises(): IPSChartYAxis[] | null {
    if (this.pschartyaxises == null) {
      this.pschartyaxises = this.fillChildListModel(this.M.getPSChartYAxises, 'control.chart.IPSChartYAxis') as IPSChartYAxis[];
    }
    return this.pschartyaxises;
  }

  get psChartYAxises(): IPSChartYAxis[] | null {
    return this.getPSChartYAxises();
  }

  findPSChartYAxis(objKey: any): IPSChartYAxis | null {
    return this.getPSModel5('control.chart.IPSChartYAxis', this.getPSChartYAxises(), objKey) as IPSChartYAxis;
  }

  get cls(): string {
    return 'PSChartImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.chart.IPSChart') return true;
    return super.instanceof(cls);
  }
}
